home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / howtoo1r / sending_.bas < prev    next >
Encoding:
BASIC Source File  |  1999-08-25  |  897 b   |  36 lines

  1. Attribute VB_Name = "sending_data"
  2. Sub send_data(socket As Integer, data As String)
  3. 'use this to send data out to 1 socket.
  4. 'all of my server code will use this.
  5. If data = "" Then Exit Sub
  6.  
  7. main.sock(socket).SendData data
  8. DoEvents
  9.  
  10. End Sub
  11.  
  12. Sub mass_send(data As String, exception_socket As Integer)
  13. 'this sends data out to EVERY client connected,
  14. 'except for the 'exception_socket' socket. leave
  15. 'exception_socket' as '0' if you want no exceptions.
  16.  
  17. 'send data to every connected socket
  18. Dim i As Integer
  19. For i = 1 To (main.sock.Count - 1)
  20. If main.sock(i).State = sckConnected And i <> exception_socket Then send_data i, data
  21. Next i
  22.  
  23. End Sub
  24.  
  25. Sub send_data_to_clientid(clientid As Integer, data As String)
  26. 'use this to send data to a clientid, saves you having
  27. 'to find out their socket.
  28.  
  29. 'simple, but saves time
  30. send_data get_socket(clientid), data
  31.  
  32. End Sub
  33.  
  34.  
  35.  
  36.